import ViewBase from "../../../engine/ViewBase";
import { ClubSocketClient } from "../../../net/ClubSocketClient";
import { UIHelper } from "../../util/UIHelper";


const { ccclass, property } = cc._decorator;

@ccclass
export default class ViewClubCreate extends ViewBase {

    private txtName: cc.EditBox

    onEnable(): void {
        super.onEnable();
        this.txtName = this.getChild(this.node, "txtName", cc.EditBox)
        let btnOK: cc.Node = this.findChild(this.node, "btnOK")
        UIHelper.onAddEvent(btnOK, () => {
            if (this.txtName.string == "") {
                UIHelper.showCheck("请输入正确名字")
                return;
            }
            this.closeView()
            ClubSocketClient.req_club_create(this.txtName.string)
        })
    }

    onDisable(): void {
        super.onDisable()
    }
}
